package com.ruoyi.car.service.parts.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.car.pojo.TbPartTerminalInformation;
import com.ruoyi.car.mapper.parts.TbPartTerminalInformationMapper;
import com.ruoyi.car.service.parts.ITbPartTerminalInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TbPartTerminalInformationServiceImpl implements ITbPartTerminalInformationService {
    @Autowired
    private TbPartTerminalInformationMapper terminalInformationMapper;
    @Override
    public List<TbPartTerminalInformation> terminalTypeList(String terminal_name, Long terminal_id, Long terminal_model_id) {
        QueryWrapper<TbPartTerminalInformation> tbPartTerminalInformationQueryWrapper = new QueryWrapper<>();
        tbPartTerminalInformationQueryWrapper.like(terminal_name != null,"terminal_name",terminal_name);
        tbPartTerminalInformationQueryWrapper.like(terminal_id   != null,"terminal_id",terminal_id);
        tbPartTerminalInformationQueryWrapper.like(terminal_model_id != null,"terminal_model_id",terminal_model_id);
        return this.terminalInformationMapper.selectList(tbPartTerminalInformationQueryWrapper);
    }

    @Override
    public void terminalInformationInsert(TbPartTerminalInformation tbPartTerminalInformation) {
        final int insert = terminalInformationMapper.insert(tbPartTerminalInformation);
    }

    @Override
    public TbPartTerminalInformation terminalInformationById(Long id) {
        TbPartTerminalInformation tbPartTerminalInformation = terminalInformationMapper.selectById(id);
        return tbPartTerminalInformation;
    }

    @Override
    public void terminalInformationUpdate(TbPartTerminalInformation tbPartTerminalInformation) {
        int i = this.terminalInformationMapper.updateById(tbPartTerminalInformation);
    }
}
